<?php

namespace zhtfrontend\models\datas;

use Yii;

/**
 * This is the model class for table "{{%comment_relation}}".
 *
 * @property integer $comment_id
 * @property integer $comment_info_id
 * @property string $for_value
 */
class CommentRelation extends \zhtfrontend\components\bases\BaseModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%comment_relation}}';
    }


    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['comment_id', 'comment_info_id'], 'required'],
            [['comment_id', 'comment_info_id'], 'integer'],
            [['for_value'], 'string', 'max' => 50]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'comment_id' => Yii::t('zhtfrontend', '评论编号'),
            'comment_info_id' => Yii::t('zhtfrontend', '评论信息编号'),
            'for_value' => Yii::t('zhtfrontend', '对应值'),
        ];
    }

    public function getCommentInfo()
    {
        return $this->hasOne(CommentInfo::className(), ['id' => 'comment_info_id']);
    }
}
